package org.xshop.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.xshop.model.TMemberNotify;
import org.xshop.service.ITMemberNotifyService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.ibase4j.core.base.AppBaseController;
import top.ibase4j.core.util.DataUtil;
import top.ibase4j.core.util.WebUtil;

/**
 * <p>
 * 会员通知记录 前端控制器
 * </p>
 *
 * @author ShenHuaJie
 * @since 2017-06-19
 */
@Controller
@RequestMapping("/app/member/")
@Api(tags = "MemberNotify", value = "个人中心-会员通知", description = "APP-个人中心-会员通知")
public class TMemberNotifyController extends AppBaseController<TMemberNotify, ITMemberNotifyService> {
    @ApiOperation(
        value = "会员通知",
        notes = "会员通知",
        produces = MediaType.APPLICATION_JSON_VALUE,
        response = TMemberNotify.class)
    @RequestMapping(value = "getNotify.api", method = {RequestMethod.GET, RequestMethod.POST})
    public Object update(HttpServletRequest request, String memberId) {
        Map<String, Object> param = WebUtil.getParameter(request);
        Long id = getCurrUser(request);
        if (DataUtil.isNotEmpty(id)) {
            param.put("memberId", id);
        }
        Assert.notNull(param.get("memberId"), "用户ID不能为空.");
        return super.query(param);
    }

}
